import {clone} from 'xe-utils';

export const CopyObj = (target, original) => {
	if (original) {
		//解除obs
		original = clone(original, true);
		Object.keys(target).forEach(key => {
			target[key] = original[key];
		});
	}
}


export const ArrToObj = (target, getKey, getVal) => {
	let obj = {};
	if (target) {
		for (const item of target) {
			obj[getKey(item)] = getVal ? getVal(item) : item;
		}
	}
	return obj;
}